home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_noworktalk.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  224 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_NoWorkTalk.cog
  4. #
  5. # Indy comments upon an unsatisfactory situation
  6. #
  7. # [HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. # NOTE: This is a random verbal reaction when Indy's efforts fail.
  13. # Glue it into your level and reach it from a calling cog like this:
  14. #
  15. # 1. Create a valid reference to this cog in your calling cog;
  16. #
  17. # 2. Use the following verb:
  18. #    SendMessageEx(thiscogREF, i_userMessage, f_parm0, f_parm1, f_parm2, f_parm3);
  19. #    (see each section below for details...)
  20. #
  21. # 3. Use global15 as a semaphore and return value where neeeded;
  22. #
  23. # The resulting chatter is pre-approved by HB...
  24. #
  25. # PRODUCT SUPPORT:  cogsrus x8371
  26.  
  27. # ==============================================================================
  28.  
  29. symbols
  30.  
  31. # ................................. MESSAGES ...................................
  32.  
  33.     message user0    # doubt lines
  34.     message user1    # didn't work lines
  35.  
  36. # ................................. SAY LINES ..................................
  37.  
  38.     # doubt lines...
  39.     sound    in_sayline=Inxj058.wav                local # That won't work-->in_sayline[0]
  40.     sound    in_notanswer=Inxj060.wav            local # Not the right answer
  41.     sound    in_notsure=Inxj061.wav                local # Not sure good idea
  42.     sound    in_neverwork=Inxj059.wav            local # That will never work
  43.  
  44.     # didn't work lines...
  45.     sound    in_nowork=Inxj089.wav                local # That didn't work-->in_sayline[4]
  46.     sound    in_somethingwrong=Inxj090.wav        local # ...something wrong.
  47.     sound    in_hmnotquite=Inxj092.wav            local # Hmm...didn't quite work.
  48.     sound    in_notright=Inxj060.wav                local # I don't think...right answer
  49.     sound    in_whoops=Inxj087.wav                local # Whoops.
  50.     sound    in_nope=Inxj088.wav                    local # Nope.
  51.     sound    in_ofcourseno=Inxj091.wav            local # Of course that didn't work.
  52.  
  53. # ............................... VARIABLES ....................................
  54.  
  55.     flex    talkerREF                            local
  56.     flex    forceTalk                            local
  57.     flex    forceLine                            local
  58.     
  59.     int        lineindex                            local # indexes sound array
  60.     int        doubtoffset=0                        local # define
  61.     int        noworkoffset=4                        local # define 
  62.  
  63.     int        alreadyworking=0                    local
  64.  
  65.     int        d_newline=50                        local # init outside actual range
  66.     int        d_oldline=50                        local
  67.     int        w_newline=50                        local
  68.     int        w_oldline=50                        local
  69.  
  70.     int        dummy
  71.  
  72.     flex        randdoubtlines                        local
  73.     flex        randnoworklines                        local
  74.     
  75. end
  76.  
  77. # ==============================================================================
  78.  
  79. code
  80.  
  81. # ..............................................................................
  82.  
  83. user0:
  84.  
  85.     # NOTE: Indy expresses DOUBT that something he tries will work...
  86.     # (Useful when Indy does something so offbeat that it doesn't
  87.     # even qualify as a legitimate failed attempt)
  88.     #
  89.     # Proper command to reach this response section from the calling cog is:
  90.     #
  91.     # SendMessageEx(negtalkcogREF, user0, f_talkerREF, f_forceTalk, f_forceLine, 0);
  92.     #
  93.     # global15 is used here like so:
  94.     #
  95.     # global15 == 0 while this cog is at work (waiting for line to finish)
  96.     # global15 == 1 upon return
  97.     #
  98.     # As discussed in user0 section, the calling cog can use global15 as a semaphore
  99.     #
  100.     # Hey!  You can also force a line choice.  Here's how:
  101.     # 1. Note your intention by setting f_forceTalk parm to some non-zero value
  102.     # 2. Examine the available lines to find the one you want (counting from 0)
  103.     # 3. Pass that number in the forceLine parameter (parm2) 
  104.  
  105.     if (alreadyworking > 0)
  106.     {
  107.         return;
  108.     }
  109.  
  110.     alreadyworking = 1; # stall multiple calls
  111.  
  112.     global15 = 0; # init each call
  113.  
  114.     talkerREF = GetParam(0); # is player or an actor talking? (a cast)
  115.     forceTalk = GetParam(1); # force a choice
  116.     forceLine = GetParam(2); # actual line choice
  117.     
  118.     if (forceTalk > 0)
  119.     {
  120.         d_newline = forceLine; # choose this line
  121.         d_oldline = 0;
  122.     }
  123.  
  124.     call randdoubtlines;
  125.     global15 = 1;
  126.     alreadyworking = 0;
  127.  
  128.     return;
  129.  
  130. # ........................................................................................
  131.  
  132. user1:
  133.  
  134.     # NOTE: Indy laments that something he tried DIDN'T WORK as hoped... 
  135.     # (Useful when Indy tried something in the right circumstances, but it failed.)
  136.     #
  137.     # Proper command to reach this response section from the calling cog is:
  138.     #
  139.     # SendMessageEx(negtalkcogREF, user1, f_talkerREF, f_forceTalk, f_forceLine, 0);
  140.     #
  141.     # global15 is used here like so:
  142.     #
  143.     # global15 == 0 while this cog is at work (waiting for line to finish)
  144.     # global15 == 1 upon return
  145.     #
  146.     # As discussed in user0 section, you can force a line choice.
  147.  
  148.     if (alreadyworking > 0)
  149.     {
  150.         return;
  151.     }
  152.  
  153.     alreadyworking = 1; # stall multiple calls
  154.  
  155.     global15 = 0; # init each call
  156.  
  157.     talkerREF = GetParam(0); # is player or an actor talking? (a cast)
  158.     forceTalk = GetParam(1); # force a choice
  159.     forceLine = GetParam(2); # actual line choice
  160.     
  161.     if (forceTalk > 0)
  162.     {
  163.         w_newline = forceLine; # choose this line
  164.         w_oldline = 0;
  165.     }
  166.  
  167.     call randnoworklines;
  168.     global15 = 1;
  169.     alreadyworking = 0;
  170.  
  171.     return;
  172.  
  173. # ........................................................................................
  174.  
  175. randdoubtlines:
  176.  
  177.     # NOTE: never say same line twice in a row
  178.     # and say some lines less frequently than others
  179.     
  180.     while (d_newline == d_oldline)
  181.     {        
  182.         d_newline = RandBetween(0, 9);
  183.         if (d_newline == 9)
  184.         {    
  185.             d_newline = 3; # 1/10 chance for line 3
  186.         }
  187.         else
  188.         {
  189.             d_newline = RandBetween(0, 2); # ~1/3 chance for lines 0 thru 2
  190.         }
  191.     }
  192.     d_oldline = d_newline; # remember choice
  193.     lineindex = doubtoffset + d_newline;
  194.  
  195.     PlayVoice(talkerREF, in_sayline[lineindex], 1, 1);
  196.  
  197.     return;
  198.  
  199. # ..............................................................................
  200.  
  201. randnoworklines:
  202.  
  203.     while (w_newline == w_oldline)
  204.     {        
  205.         w_newline = RandBetween(0, 29);
  206.         if (w_newline > 26)
  207.         {
  208.             w_newline = (w_newline - 23); # 1/10 chance for 4, 5 or 6
  209.         }
  210.         else
  211.         {    
  212.             w_newline = RandBetween(0, 3); # ~1/4 chance for 0 thru 3
  213.         }
  214.     }
  215.     w_oldline = w_newline;
  216.     lineindex = noworkoffset + w_newline;
  217.  
  218.     PlayVoice(talkerREF, in_sayline[lineindex], 1, 1);
  219.  
  220.     return;
  221.  
  222. end
  223.  
  224.